//
//  KaiJuFaPiaoInfoCell.m
//  DistributorAB
//
//  Created by 李 on 2019/12/9.
//  Copyright © 2019 主事丫环. All rights reserved.
//

#import "KaiJuFaPiaoInfoCell.h"

@implementation KaiJuFaPiaoInfoCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.infoWordsLab.font = KFontPingFangSCRegular(16);
    self.jieShouWordsLab.font = KFontPingFangSCRegular(16);
    self.geRenBtn.titleLabel.font =KFontPingFangSCRegular(14);
    self.gongSiBtn.titleLabel.font =KFontPingFangSCRegular(14);
    self.taiTouWordsLab.font = KFontPingFangSCRegular(14);
    self.phoneOrShuiHaoWordsLab.font = KFontPingFangSCRegular(14);
    self.youXiangWordsLab.font = KFontPingFangSCRegular(14);
    self.taiTouTF.font =KFontPingFangSCRegular(14);
    self.phoneOrShuiHaoTF.font =KFontPingFangSCRegular(14);
    self.emailTF.font =KFontPingFangSCRegular(14);
     
    self.geRenBtn.selected = YES;
    self.gongSiBtn.selected = NO;
    self.phoneOrShuiHaoTF.placeholder = @"请输入手机号";
    self.emailTF.placeholder = @"请输入电子邮箱";
    self.taiTouTF.delegate = self;
    self.phoneOrShuiHaoTF.delegate = self;
    self.emailTF.delegate = self;
    NSMutableAttributedString *attStr = [NSString getAttributedStringWithOriginalString:self.taiTouWordsLab.text originalColor:[UIColor colorWithHexString:@"#666666"] originalFont:FontSize(14) originalLineSpacing:0 changeString:@"*" changeColor:[UIColor colorWithHex:0xF42850] changeFont:FontSize(14)];
    self.taiTouWordsLab.attributedText = attStr;
    
   
    NSMutableAttributedString *attStr2 = [NSString getAttributedStringWithOriginalString:self.phoneOrShuiHaoWordsLab.text originalColor:[UIColor colorWithHexString:@"#666666"] originalFont:FontSize(14) originalLineSpacing:0 changeString:@"*" changeColor:[UIColor colorWithHex:0xF42850] changeFont:FontSize(14)];
    self.phoneOrShuiHaoWordsLab.attributedText = attStr2;
    
    NSMutableAttributedString *attStr3 = [NSString getAttributedStringWithOriginalString:self.youXiangWordsLab.text originalColor:[UIColor colorWithHexString:@"#666666"] originalFont:FontSize(14) originalLineSpacing:0 changeString:@"*" changeColor:[UIColor colorWithHex:0xF42850] changeFont:FontSize(14)];
    self.youXiangWordsLab.attributedText = attStr3;
    
}
//个人 发票信息类型 0
- (IBAction)geRenBtnClick:(UIButton *)sender {
    self.geRenBtn.selected = YES;
    self.gongSiBtn.selected = NO;
    if (self.infoTypeBtnClickBlock) {
        self.infoTypeBtnClickBlock(0);
    }
}
//公司 发票信息类型 1
- (IBAction)gongSiBtnClick:(UIButton *)sender {
       self.geRenBtn.selected = NO;
       self.gongSiBtn.selected = YES;
       if (self.infoTypeBtnClickBlock) {
           self.infoTypeBtnClickBlock(1);
       }
    
}
#pragma UITextFieldDelegate
- (void)textFieldEditChanged:(UITextField *)textField
{
    if (textField == self.taiTouTF) {
        if (self.taiTouTFHandle) {
            self.taiTouTFHandle(textField.text);
        }
    }
    else if (textField == self.phoneOrShuiHaoTF) {
           if (self.phoneOrShuiHaoTFHandle) {
               self.phoneOrShuiHaoTFHandle(textField.text);
           }
       }
    else if (textField == self.emailTF) {
           if (self.emailTFHandle) {
               self.emailTFHandle(textField.text);
           }
       }
}
- (void)textFieldDidEndEditing:(UITextField *)textField
{
    if (textField == self.taiTouTF) {
           if (self.taiTouTFHandle) {
               self.taiTouTFHandle(textField.text);
           }
       }
       else if (textField == self.phoneOrShuiHaoTF) {
              if (self.phoneOrShuiHaoTFHandle) {
                  self.phoneOrShuiHaoTFHandle(textField.text);
              }
          }
       else if (textField == self.emailTF) {
              if (self.emailTFHandle) {
                  self.emailTFHandle(textField.text);
              }
          }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
